package 一些算法竞赛测试题;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a
 * Date: 2022-10-15
 * Time: 20:48
 */
//立方体的DFS
public class Demo14 {
    private static int[] getX = {1, 0, 0, -1, 0, 0};
    private static int[] getY = {0, 1, 0, 0, -1, 0};
    private static int[] getZ = {0, 0, 1, 0, 0, -1};

    private static int res = 1;

    private static void DFS(char[][][] q, int z, int x, int y, int k, int n, int m){
        for(int i = 0; i < 6; i++){
            int newx = x + getX[i];
            int newy = y + getY[i];
            int newz = z + getZ[i];
            if(newx >= 0 && newx < n && newy >= 0 && newy < m && newz >= 0 && newz < k && q[newz][newx][newy] == '.'){
                q[newz][newx][newy] = '#';
                res++;
                DFS(q, newz, newx, newy, k, n, m);
            }
        }
    }

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        char[][][] q = new char[k][n][m];
        for(int i = 0; i < k; i++){
            for(int j = 0; j < n; j++){
                String s = scanner.next();
                for(int t = 0; t < m; t++){
                    q[i][j][t] = s.charAt(t);
                }
            }
        }
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        q[0][x - 1][y - 1] = '#';
        DFS(q, 0, x - 1, y - 1, k, n, m);
        System.out.println(res);
    }
}
